'use strict';

module.exports = app => {
  const { STRING, INTEGER, TEXT, DATE, JSON } = app.Sequelize;

  const Resume = app.model.define('resume', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
      comment: '简历ID'
    },
    user_id: {
      type: INTEGER,
      allowNull: true,
      defaultValue: 1,
      comment: '用户ID'
    },
    template_id: {
      type: INTEGER,
      allowNull: false,
      comment: '模板ID'
    },
    resume_name: {
      type: STRING(150),
      allowNull: false,
      comment: '简历名称（格式：时间_姓名）'
    },
    basic_info: {
      type: JSON,
      allowNull: false,
      comment: '基本信息（JSON格式）'
    },
    education_list: {
      type: JSON,
      allowNull: true,
      comment: '教育经历（JSON格式）'
    },
    work_list: {
      type: JSON,
      allowNull: true,
      comment: '工作经历（JSON格式）'
    },
    skills_list: {
      type: TEXT,
      allowNull: true,
      comment: '技能列表'
    },
    photo_url: {
      type: STRING(255),
      allowNull: true,
      comment: '照片URL'
    },
    status: {
      type: INTEGER,
      defaultValue: 1,
<<<<<<< HEAD
      comment: '状态：1-草稿，2-完成'
=======
      comment: '状态：1-草稿，2-完成，3-已发布'
    },
    is_shared: {
      type: INTEGER,
      defaultValue: 0,
      comment: '是否分享：0-未分享，1-已分享'
>>>>>>> resume
    }
  }, {
    tableName: 'resume',
    timestamps: true,
    underscored: true,
    createdAt: 'created_at',
    updatedAt: 'updated_at'
  });

  return Resume;
};

